package com.weiyuwqj.admin.controller.admin.sys;

import com.weiyuwqj.api.service.SysResourceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by zhangyong on 2016/7/21.
 */
@Controller
@RequestMapping("/admin/resource")
public class ResourceController {

    @Autowired
    SysResourceService resourceService;

    //后台左边导航栏根据userId查询该用户能操作的栏目
    @ResponseBody
    @RequestMapping("/list")
    public Object list(HttpServletRequest request){
        Integer userId = (Integer)request.getSession().getAttribute("userId");
        return resourceService.getResources(userId);
    }

    //后台展示所有的资源列表
    @ResponseBody
    @RequestMapping("/getList")
    public Object getList(){
        return resourceService.getList();
    }
}
